package com.okami.java8.method.reference;

/**
 * @description: Lambda表达式递归
 * @author: TanJingyu
 * @create: 2020-09-11 16:34
 **/
public class RecursiveFactorial {
    static IntCall fact;
    public static void main(String[] args) {
        fact = n -> n == 0 ? 1 : n * fact.call(n - 1);
        for(int i = 0; i <= 10; i++) {
            System.out.println(fact.call(i));
        }
    }
}

interface IntCall {
    int call(int arg);
}
